package com.gs.cd.cloud.start.config;

import com.gs.cd.api.ApiResult;
import com.gs.cd.cloud.start.exception.DefaultGlobalExceptionHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * Create By Hippo 2020/12/24
 *
 * @Description: 服务启动检测
 * update By seven 2020/12/25
 * 使用静态内部类防止 spring 扫描到 '/' 这个路径 从而报错
 * 可以编写新的controller直接覆盖 '/' 这个url
 */


public class DefaultCheckController {
    @RestController
    @RequestMapping
    public static class CheckServiceStatusDefault {
        @Value("${spring.application.name}")
        String applicationName;

        @RequestMapping("/")
        public ApiResult check() {
            return ApiResult.success(String.format(" %s is OK... ^_^ ", applicationName));
        }
    }
}

